#
# build module source file to STATIC|SHARED library
# add_library : https://cmake.org/cmake/help/v3.10/command/add_library.html#command:add_library
#
# install(TARGETS ${target} DESTINATION lib)
# install(FILES ${head_file.h} DESTINATION include/${PROJECT_NAME})
# install(DIRECTORY ${dir} DESTINATION include/${PROJECT_NAME})
#

aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} ${COMPONENT_NAME}_SRCS)

if(${BUILD_STATIC_LIBS} STREQUAL "ON")
    add_library(${COMPONENT_NAME}_static STATIC ${${COMPONENT_NAME}_SRCS})
    set_target_properties(${COMPONENT_NAME}_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    set_target_properties(${COMPONENT_NAME}_static PROPERTIES OUTPUT_NAME "${COMPONENT_NAME}")
    install(TARGETS ${COMPONENT_NAME}_static DESTINATION lib)
endif()

if(${BUILD_SHARED_LIBS} STREQUAL "ON")
    add_library(${COMPONENT_NAME} SHARED ${${COMPONENT_NAME}_SRCS})
    set_target_properties(${COMPONENT_NAME} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    set_target_properties(${COMPONENT_NAME} PROPERTIES VERSION ${COMPONENT_VERSION_MAJOR}.${COMPONENT_VERSION_MINOR}.${COMPONENT_VERSION_PATCH} SOVERSION ${COMPONENT_VERSION_MAJOR})
    install(TARGETS ${COMPONENT_NAME} DESTINATION lib)
endif()

install(FILES bit_util.h DESTINATION include/${PROJECT_NAME})
install(FILES convert_util.h DESTINATION include/${PROJECT_NAME})
install(FILES compare_util.h DESTINATION include/${PROJECT_NAME})
